package com.orion.config.security;

import com.orion.entity.Result;
import com.orion.enumeration.CommonCodeEnum;
import com.orion.util.ResponseUtil;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.server.WebFilterExchange;
import org.springframework.security.web.server.authentication.logout.ServerLogoutSuccessHandler;
import reactor.core.publisher.Mono;

/**
 * @author Administrator
 * @date 2021/11/10
 */
public class CustomServerLogoutHandler implements ServerLogoutSuccessHandler {

    @Override
    public Mono<Void> onLogoutSuccess(WebFilterExchange exchange, Authentication authentication) {
        System.out.println("in CustomServerLogoutHandler :" + authentication);
        Result r = CommonCodeEnum.COMMON_UNKNOWN_ERROR.toResult();
        return ResponseUtil.jsonResp(exchange.getExchange().getResponse(), r);
    }
}
